package c2.group.business.teampvp;

import cate.common.table.d.GDTeamPvp;
import cate.game.play.part.PlaySide;
import cate.game.role.farm.TimeBasedPlayTimes;
import cp.solution.pattern.ICopiable;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass("组队池玩家信息")
public class TeamPvpPlayer implements ICopiable<TeamPvpPlayer> {
    @NoteField("阵容")
    public PlaySide ps;

    @NoteField("服务器标识")
    public String abbr;

    @NoteField("积分")
    public long score;

    @NoteField("战力")
    public long power;

    @NoteField("占领AND掠夺次数")
    public TimeBasedPlayTimes fightTimes;

    @NoteField("挑战次数")
    public int challengeTimes;

    @Override
    public TeamPvpPlayer copy() {
        TeamPvpPlayer cp = new TeamPvpPlayer();
        cp.ps = this.ps.copy();
        cp.power = this.power;
        cp.score = this.score;
        return cp;
    }

    public void challengeOnce() {
        fightTimesInit();
        fightTimes.useCurrent();
        challengeTimes ++;
    }

    public void fightTimesInit() {
        if (fightTimes == null) {
            fightTimes = new TimeBasedPlayTimes(GDTeamPvp.INIT_TIMES);
            fightTimes.setup(GDTeamPvp.MAX_TIMES, GDTeamPvp.RECOVER_SECONDS * 1000L);
        }
    }
}
